//
//  UserId.h
//  playSerengetiMobile1
//
//  Created by Lita Gratrix on 10/25/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "User.h"
#import "Team.h"
#import "Location.h"
#import "UserProfile.h"
#import "TeamProfile.h"
#import "SerengetiCLController.h"
#import "playSerengetiMobile1AppDelegate.h"



@interface UserHome : UIViewController <UITableViewDataSource, UITableViewDelegate> {
	UILabel *displayNameLabel;
	UILabel *emailLabel;
	UITableView *userProfileTableView;
	
	NSURLConnection *userHomeConnection;
	NSURLConnection *nearbyLocationsConnection;
	NSMutableData *responseData;
	
	User *profile;
	NSMutableArray *friendInvites;
	NSMutableArray *teamInvites;
	NSMutableArray *friends;
	NSMutableArray *teams;
	NSMutableArray *nearbyLocations;
	
	double latitude;
	double longitude;
	
	NSMutableArray *tableSourceArray;

	SerengetiCLController *locationController;
	playSerengetiMobile1AppDelegate *appDelegate;
	
}

@property (nonatomic, retain) IBOutlet UILabel *displayNameLabel;
@property (nonatomic, retain) IBOutlet UILabel *emailLabel;
@property (nonatomic, retain) IBOutlet UITableView *userProfileTableView;

@property (nonatomic, retain) NSURLConnection *userHomeConnection;
@property (nonatomic, retain) NSURLConnection *nearbyLocationsConnection;

@property (nonatomic, retain) User *profile;
@property (nonatomic, retain) NSMutableArray *friendInvites;
@property (nonatomic, retain) NSMutableArray *teamInvites;
@property (nonatomic, retain) NSMutableArray *friends;
@property (nonatomic, retain) NSMutableArray *teams;
@property (nonatomic, retain) NSMutableArray *nearbyLocations;

@property (nonatomic, readwrite) double latitude;
@property (nonatomic, readwrite) double longitude;

@property (nonatomic, retain) NSMutableArray *tableSourceArray;

@property (nonatomic, retain) SerengetiCLController *locationController;
@property (nonatomic, retain) playSerengetiMobile1AppDelegate *appDelegate;

- (void)checkInSubmit:(id)sender;

- (void)populateViewData:(NSDictionary *)parsedData;
- (void)populateUser:(NSDictionary *)userDictionary;
- (void)populateInvites:(NSDictionary *)inviteDictionary;
- (void)populateFriendInvites:(NSMutableArray *) friendInviteArray;
- (void)populateTeamInvites:(NSMutableArray	*) teamInviteArray;
- (void)populateFriends:(NSMutableArray *)friendArray;
- (void)populateTeams:(NSMutableArray *)teamArray;
- (void)getCurrentLocation;
- (void)populateNearbyLocations:(NSDictionary *)nearbyLocationsArray;
- (Team *)populateTeamOwner:(NSDictionary *)teamDic;


@end
